<?php
function demo() {
    $sql = <<<SQL
SELECT demo from DEMO 
SQL;
    $cx = mysql_connect
            ('localhost'
            ,'cs446'
            ,'644sc');
    if(! mysql_select_db('uwiss', $cx) ) die( mysql_error() );
    $result = mysql_query($sql, $cx);
    $r = mysql_fetch_assoc($result);
    $demo = $r['demo'];

    if($demo == 1) {
        $demo = 0;
    } else if($demo == 0) {
        $demo = 1;
    }

    $sql = <<<SQL
UPDATE DEMO set demo=$demo 
SQL;
    $result = mysql_query($sql, $cx);
}

include '../view/admin_gen.php';
?>
